from enum import Enum
from json import loads
from typing import Any


class MimoStatus(Enum):
    IDLE = 1  # 空闲
    REVIEWING = 1 << 1  # 审核中
    LOCKED = 1 << 2  # 已锁定
    FAILED = 1 << 3  # 失败

    DECODING = 1 << 6  # 解码中
    PLOTTING = 1 << 7  # 绘图中


class MimoProcessor:
    def __init__(self, body: bytes) -> None:
        body_dict = loads(s=body)

        self.id: int = body_dict["id"]
        self.args: dict[str, Any] = body_dict["args"]

        self.number_of_receive_antennas: int = self.args["receiveAntennas"]
        self.modulationMode: int = self.args["modulationMode"]
        self.noise_rate = float(self.args["noiseRate"])
